Add POSIX configuration migration and legacy-format warnings - #5159
Conversation
1ddfbaf to
895cda7
Compare
895cda7 to
ded5bac
Compare
3fe3835 to
7cd3af3
Compare
7cd3af3 to
9f5c005
Compare
9f5c005 to
b350b09
Compare
b350b09 to
b615b7d
Compare
4908b42 to
f3e474d
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The migration overwrite path currently emits a replacement warning twice (direct Console.Error + warning logger routed to stderr), producing duplicated stderr output.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adds a stable (legacy src/ CLI) POSIX-only gitversion config migrate command that migrates legacy flat (v6) configuration YAML into the nested v7 calculation/output structure, and introduces explicit-v6 compatibility warnings that are routed to stderr to avoid contaminating machine-readable stdout.
Changes:
- Adds a configuration migration engine (
ConfigurationMigrationService) plus YAML mapping helpers (ConfigurationDocumentMapper.Nest). - Adds the POSIX
config migratesubcommand wiring, executor, and options surface (GitVersionOptions.ConfigurationMigrationInfo). - Adds explicit v6-selection detection and warning behavior, plus stdout/stderr isolation updates and test coverage.
File summaries
| File | Description |
|---|---|
| src/GitVersion.Core/PublicAPI.Unshipped.txt | Tracks the newly exposed ConfigurationMigrationInfo API surface. |
| src/GitVersion.Core/Options/GitVersionOptions.cs | Adds ConfigurationMigrationInfo to top-level execution options. |
| src/GitVersion.Core/Options/ConfigurationMigrationInfo.cs | Introduces migration-specific options (input/output/in-place/force). |
| src/GitVersion.Core/Extensions/ServiceCollectionExtensions.cs | Routes warnings to stderr when console logging is disabled to keep stdout machine-readable. |
| src/GitVersion.Core/Configuration/IConfigurationMigrationService.cs | Defines the migration service contract. |
| src/GitVersion.Core/Configuration/ConfigurationVersion.cs | Adds IsExplicitV6() to detect explicit v6 selection. |
| src/GitVersion.Core.Tests/Core/ConfigurationVersionSelectorTests.cs | Adds unit tests for explicit v6 selection detection. |
| src/GitVersion.Configuration/GitVersionConfigurationModule.cs | Registers the migration service in DI. |
| src/GitVersion.Configuration/ConfigurationSerializer.cs | Adds deterministic serialization for migrated YAML documents. |
| src/GitVersion.Configuration/ConfigurationProvider.cs | Logs once-per-invocation warning when explicit v6 loads a user config file. |
| src/GitVersion.Configuration/ConfigurationMigrationService.cs | Implements v6→v7 migration with validation and mixed-structure rejection. |
| src/GitVersion.Configuration/ConfigurationDocumentMapper.cs | Adds nesting logic and branch splitting between calculation/output sections. |
| src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.cs | Adds tests for explicit v6 warning behavior and non-warning cases. |
| src/GitVersion.Configuration.Tests/Configuration/ConfigurationMigrationServiceTests.cs | Adds migration unit tests for nesting, determinism, and invalid input handling. |
| src/GitVersion.App/LegacyArgumentParser.cs | Explicitly rejects config migrate under the legacy (non-POSIX) parser. |
| src/GitVersion.App/IConfigurationMigrationExecutor.cs | Adds executor contract for the migration command. |
| src/GitVersion.App/GitVersionAppModule.cs | Registers the migration executor in DI. |
| src/GitVersion.App/GitVersionApp.cs | Dispatches to migration executor when migration is requested. |
| src/GitVersion.App/ConfigurationMigrationExecutor.cs | Implements file discovery, safeguards, and atomic write for migrated configs. |
| src/GitVersion.App/Arguments.cs | Adds migration argument fields and maps them into GitVersionOptions. |
| src/GitVersion.App/ArgumentParser.cs | Adds config migrate subcommand parsing and safeguards (--output vs --in-place, --force). |
| src/GitVersion.App.Tests/LegacyArgumentParserTests.cs | Tests that legacy parser rejects config migrate clearly. |
| src/GitVersion.App.Tests/JsonOutputOnBuildServerTest.cs | Updates tests to validate JSON via captured stdout (not mixed streams). |
| src/GitVersion.App.Tests/HelpWriterTests.cs | Excludes migration-only internal argument fields from help completeness checks. |
| src/GitVersion.App.Tests/Helpers/GitVersionHelper.cs | Captures stdout/stderr separately while preserving combined output for existing assertions. |
| src/GitVersion.App.Tests/Helpers/ExecutionResults.cs | Exposes StandardOutput/StandardError for stream-specific assertions. |
| src/GitVersion.App.Tests/ConfigurationVersionIntegrationTests.cs | Adds integration tests for migration command behaviors and stderr warning isolation. |
| src/GitVersion.App.Tests/ConfigurationMigrationExecutorTests.cs | Adds unit test ensuring overwrite warnings are logged during in-place migration. |
| src/GitVersion.App.Tests/ArgumentParserTests.cs | Adds parser tests for config migrate options and safeguards. |
Review details
- Files reviewed: 29/29 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
f3e474d to
465f9c8
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The implementation aligns with the stated acceptance criteria (migration behavior, safeguards, explicit-v6 warning semantics, and stdout/stderr isolation) and is covered by targeted unit/integration tests.
Review details
- Files reviewed: 29/29 changed files
- Comments generated: 0 new
- Review effort level: Lite
dbc6bc0 to
a3b0d15
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Logging-to-stdout behavior in BuildServer output mode may still interleave warnings/logs with machine-consumed output, conflicting with the intended stdout isolation.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 28/28 changed files
- Comments generated: 1
- Review effort level: Lite
a3b0d15 to
bce1070
Compare
There was a problem hiding this comment.
🟡 Changes recommended
config migrate reuses --config/-c at both root and subcommand scope, which can silently ignore user-specified input when options appear before the subcommand, leading to migrating the wrong file.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 28/28 changed files
- Comments generated: 1
- Review effort level: Lite
bce1070 to
2048012
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The implementation aligns with the stated acceptance criteria and is backed by comprehensive unit and integration test coverage for migration, safeguards, and stdout/stderr behavior.
Review details
- Files reviewed: 28/28 changed files
- Comments generated: 0 new
- Review effort level: Lite
2048012 to
02c4722
Compare
|
|
Tick the box to add this pull request to the merge queue (same as
|
|
Thank you @arturcic for your contribution! |



Summary
gitversion config migratecommand with atomic output, overwrite safeguards, and explicit-v6 warnings.workflowwhile migrating flat settings intocalculationandoutput.calculation.workflow; duplicate selectors andoutput.workfloware rejected. Runtime loading remains strict.Validation
Closes #5133